<template>
  <div class="interviewing">
    <van-nav-bar title="面试技巧" @click-left="$router.go(-1)" placeholder >
      <template #left>
        <van-icon name="down" size="25" />
      </template>
    </van-nav-bar>
    <div class="search">
      <van-button round type="info" icon="search">请输入关键字</van-button>
    </div>
    <!-- 刷新 -->
    <van-loading size="24px" style="text-align: center;" v-if="show"
      >加载中...</van-loading
    >
    <div class="techincItem" v-for="item in list" :key="item.id">
      <div class="left">
        <div class="left-top van-multi-ellipsis--l2">
          {{ item.title }}
        </div>
        <div class="left-bottom">
          <span class="t1">{{ item.updated_at | mymoment }}</span>

          <span class="t3"><van-icon name="eye-o" />{{ item.read }}</span>

          <span class="t5"><van-icon name="good-job-o" />{{ item.star }}</span>
        </div>
      </div>
      <img class="right" :src="'http://localhost:1337' + item.cover" alt="" />
    </div>
  </div>
</template>

<script>
import moment from 'moment'
import { technicList } from './exercise'
export default {
  data () {
    return {
      list: [],
      show: false
    }
  },
  methods: {
    async technic () {
      let res = await technicList()
      this.list = res.data.data.list
    }
  },
  created () {
    this.show = true
    setTimeout(() => {
      this.technic()
      this.show = false
    }, 1000)
  },
  filters: {
    mymoment (value) {
      return moment(value).format('YYYY-MM-DD')
    }
  }
}
</script>

<style lang="less">
.interviewing {
  .van-nav-bar__left {
    .van-icon {
      transform: rotate(90deg);

      color: #222;
    }
  }

  .van-nav-bar__title {
    font-weight: 700;
  }
  .search {
    margin: 10px 20px 0 20px;
    button.van-button.van-button--info.van-button--normal.van-button--round {
      width: 100%;
      /* margin: 0; */
      background: #f7f4f5;
      border: 0;
      .van-icon {
        color: #b3b3b3;
      }
      .van-button__text {
        color: #b3b3b3;
      }
    }
  }
  .techincItem {
    display: flex;
    align-items: center;
    margin-top: 50px;

    .left {
      display: flex;
      flex: 1;
      align-self: stretch;
      //改变flex主轴方向
      margin: 0 30px;
      flex-direction: column;
      margin-bottom: 20px;
      //主轴方向两端对齐
      justify-content: space-between;
      span:nth-child(2) {
        margin-right: 20px;
      }
      .left-top {
        font-size: 16px;
        font-family: PingFangSC, PingFangSC-Medium;
        font-weight: 550;
        text-align: left;
        color: #181a39;

        letter-spacing: 0px;
      }
      .left-bottom {
        margin-top: 20px;
        display: flex;
        font-size: 12px;
        color: #ccc;
        align-items: center;
        .t0 {
          margin-right: 150px;
        }
        .t1 {
          flex: 1;
        }
        .t2 {
          margin-right: 100px;
        }
        .t3 {
          margin-right: 50px;
        }
      }
    }
    .right {
      width: 226px;
      height: 150px;
      object-fit: contain;
      margin-left: 16px;
      margin-right: 30px;
      float: right;
      margin-bottom: 20px;
      border-radius: 20px;
    }
  }
}
</style>
